using UnityEngine;
using System.Collections;

public class NPC_Level06_01 : MonoBehaviour
{
    private Renderer rend;
    void Start()
    {
        CompleteFadeIn fade = gameObject.AddComponent("CompleteFadeIn") as CompleteFadeIn;
        fade.FadeIn(transform);
    }

    void Update()
    {
        if (rend.transform.GetComponent<RoomInfo>().Father.name == "_Room_02")
        {
            renderer.material.color = new Color(renderer.material.color.r, renderer.material.color.g, renderer.material.color.b, rend.material.color.a);
        }
    }

	void OnTriggerEnter (Collider obj) 
    {
        if (obj.name == "FinalDoor")
        {
            
            obj.gameObject.AddComponent("DoorDestroy");
            obj.GetComponent<DoorDestroy>().amount = 1f;
            obj.GetComponent<DoorDestroy>().notDestroy = true;
        }

        if (obj.name == "Floor")
        {
            transform.parent = obj.GetComponent<RoomInfo>().Father;
            rend = obj.renderer;
        }


	}
}
